Skip to content

Conversation

@dg845
Copy link
Collaborator

@dg845 dg845 commented Jan 10, 2026

What does this PR do?

This PR adds the supports_text_encoder_loras flag to PeftLoraLoaderMixinTests, which if set to False will skip the following text encoder LoRA tests (following #12933):

  1. test_simple_inference_with_text_lora
  2. test_simple_inference_with_text_lora_and_scale
  3. test_simple_inference_with_text_lora_fused
  4. test_simple_inference_with_text_lora_save_load
  5. test_simple_inference_with_partial_text_lora
  6. test_simple_inference_save_pretrained_with_text_lora

support_text_encoder_loras is then used in the PeftLoraLoaderMixinTests subclasses to skip these tests for LoRA loaders which don't support text encoder LoRAs. Note that previously most test classes did not skip test_simple_inference_save_pretrained_with_text_lora, which means that this test will now be skipped instead of running and passing as it did previously.

This PR also makes the following changes to LoraBaseMixin subclasses (from #12933 (comment)):

  1. In load_lora_weights, makes the invalid LoRA format error message more informative by describing the valid checkpoint format.

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@sayakpaul

@dg845 dg845 requested a review from sayakpaul January 10, 2026 07:14
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Just one comment.

is_correct_format = all("lora" in key for key in state_dict.keys())
if not is_correct_format:
raise ValueError("Invalid LoRA checkpoint.")
raise ValueError("Invalid LoRA checkpoint. Make sure all LoRA param names contain `lora`.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
raise ValueError("Invalid LoRA checkpoint. Make sure all LoRA param names contain `lora`.")
raise ValueError("Invalid LoRA checkpoint. Make sure all LoRA param names contain `"lora"` substring.")

@dg845
Copy link
Collaborator Author

dg845 commented Jan 13, 2026

Merging as the failing LoRA tests should be unrelated.

@dg845 dg845 merged commit f1a93c7 into main Jan 13, 2026
31 of 32 checks passed
@dg845 dg845 deleted the improve-lora-loaders branch January 13, 2026 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants